<template>
  <el-table :data="tableData" style="width: 100%" :fit="true" border>
    <el-table-column type="index" label="序号" width="120" align="center" />
    <el-table-column
      v-for="item in tableHeader"
      :key="item.id"
      :prop="item.prop"
      :label="item.label"
      :width="item.width"
      align="center"
      :show-overflow-tooltip="item.showTooltip"
    />
    <el-table-column label="操作" fixed="right" align="center">
      <template #default="{ row }">
        <slot name="btn" :rowData="row"></slot>
      </template>
    </el-table-column>
  </el-table>
</template>

<script lang="ts" setup>
import { ref, toRefs } from "vue";
import type { tabHeaderType } from "@/views/commodity/index";
const props = withDefaults(
  defineProps<{
    tableData: any;
    tableHeader: tabHeaderType[];
  }>(),
  {}
);
const { tableData, tableHeader } = toRefs(props);
</script>

<style lang="scss" scoped></style>
